package com.example.musicserver.service;

import com.example.musicserver.mapper.MusicInfoMapper;
import com.example.musicserver.model.MusicInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MusicInfoService {
    @Autowired
    private MusicInfoMapper musicInfoMapper;

    public List<MusicInfo> getList() {
        return musicInfoMapper.getAllList();
    }

    public List<MusicInfo> getList(String musicName) {
        return musicInfoMapper.getListByTitle(musicName);
    }

    public Integer addMusic(String title,String singer,String url,Integer userid) {
        return musicInfoMapper.addMusic(title,singer,url,userid);
    }

    public MusicInfo queryMusicByTitle(String title) {
        return musicInfoMapper.queryMusicByTitle(title);
    }

    public Integer deleteMusicByMId(Integer id) {
        return musicInfoMapper.deleteMusicByMId(id);
    }

    public MusicInfo findMusicByMId(Integer id) {
        return musicInfoMapper.findMusicByMId(id);
    }
}
